@allison_horstModule 03: Modern Presentation with Quarto
School of Mathematical and Physical Sciences
rstudio::conf(2022) by Mine Çetinkaya-Rundel and Julia Stewart Lowndesrstudio::conf(2022) by Tom MockIntroducing Quarto
Quarto is the next generation of R Markdown for publishing, including dynamic and static documents and multi-lingual programming language support.Quarto unifies and extends the R Markdown ecosystem
@allison_horstLet’s talk about Markdown first
markup (language) is a system for annotating a document in a way that is visually distinguishable from the content.Markdown is a lightwieght markup language that you have to use code to add formatting elements to your content.Artwork by @allison_horst
---
Let’s talk more about Quarto
Quarto had meaning in the history of publishing, which is the format of a book or pamphlet produced from full sheets printed with eight pages of text, four to a side, then folded twice to produce four leaves.Quarto makes moving between formats straightforward.
Quarto enables collaborating across coding languages.
Quarto flattens the learning curve.
@allison_horstRStudio v2022.07.1 and beyond!RStudio, please consider updating it.R Studio
R Studio (cont.)visual markdown editor as your default editor..rmd and .qmd are just a plain text file.render them and observe the output.03:00
YAML appears at the top of your document..qmd file to generate many different formats
htmlpdfR Markdown and Quarto can be found on the next tab.| Feature | R Markdown | Quarto |
|---|---|---|
| Basic Formats | ||
| Beamer | ||
| PowerPoint | ||
| HTML Slides | ||
| Advanced Layout | ||
| Cross References | ||
| Websites & Blogs | ||
| Books | ||
| Interactivity | ||
| Paged HTML |
|
|
| Journal Articles | ||
| Dashboards |
|
|
| Interactive Tutorials |
|
Ctrl + space to list all available YAML options.Tab key to auto-complete.Markdown Basics
Quarto is based on Pandoc and uses its variation of markdown as its underlying document syntax.
bold text
italicized text
bold and italicized text
inline math: \(E = mc^{2}\)
display math:
\[E = mc^{2}\]
Tip
R for computation.R output.
echo and always evaluates (explain more on the next few slides).```.
r: language enginecars: unique chunk name#|:
include: include chunk output or notecho: display source code or not.qmd, press
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.4
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.4.4 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.1
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Tip
There are many more options chunk options available so feel free to explore more in order to customise your work https://quarto.org/docs/computations/execution-options.html.
#|)Quarto introduces the concept/notation of #| (read the hashpipe).
Hashpipe enables a more readable way to organise your chunk options.
```{r scatterplot}
#| fig-align: "center"
#| fig-width: 4.5
#| fig-height: 4
plot(speed ~ dist, cars)
```Tip
Visual Editor
Format
Insert
Table
Cmd + / for Mac or Ctrl + / for Windows within visual editor mode to insert just about anything.
/ to invoke the shortcut.Getting started with Quarto Presentation
R Studio
File \(\rightarrow\) New File \(\rightarrow\) Quarto Presentation
Quarto supports a variety of formats for creating presentations:
revealjs – reveal.js (HTML)pptx – PowerPoinst (MS Office)beamer – Beamer (LaTeX/PDF)R Studio (Cont.)visual markdown editor as your default editor.YAML:Or turn on/off via fenced divs:
:::: {.columns}
::: {.column width='40%'}
Left column
:::
::: {.column width='60%'}
Right column
:::
::::and get output:
Left column
Right column
Addin to insert pre-written divs and classes for you.Callout Blocks are highly recommended. You should try them out!render it.quartostamp addin to add different elements and customise your slide deck.
Quarto for the Python user
VS Code
JupyterLabVS Code (or VS Code Studio)NeovimText Editor
VS Code Studio to demonstrate.
RStudio to give you a word-processor style interface.Quarto, you also need to install the Quarto extension from the VS Code Extension Marketplace
VS Code (Cont.).qmd file:VS Code (Cont.).qmd file within VS Code
revealjs.VS Code (Cont.)VS Code (Cont.)VS Code
which gives
Now that I knew which Python was being used, I could install the nbformat (or any other packages that were missing) in the Terminal with
Iris Jiang
Thomas Fung
School of Mathematical and Physical Sciences